package com.sjsoft.video;

import java.util.ArrayList;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.provider.ContactsContract.CommonDataKinds.Email;

import com.sjsoft.Utils.networkUtility;
import com.sjsoft.chat.video.ListVideo;
import com.sjsoft.chat.video.PayMoney;
import com.sjsoft.chat.video.mainTab;
import com.sjsoft.webservice.UtilsJson;

public class loadBillingInfor extends AsyncTask<Void, Void, Void>{
	int resultRequest;	
	boolean isNetWork = true;
	private String Imei;
	private String extendId;
	private String videoId;
	private int amount;

	Context mContext;
	//Constructor
	private ProgressDialog pDlg = null;
	public loadBillingInfor(Context context) {		
		mContext = context;
		isNetWork = networkUtility.getInstance(context)
				.isNetworkAvailable();
	}
	
	public void setImei(String sImei)
	{
		this.Imei = sImei;
	}
	
	
	public void setExtendId(String sExtendId)
	{
		this.extendId = sExtendId;
	}
	
	public void setVideoId(String sVideoId)
	{
		this.videoId = sVideoId;
	}
	
	public void setAmount(int amount)
	{
		this.amount = amount;
	}
	
	
	@Override
	protected void onPreExecute() {
		super.onPreExecute();	
		//showProgressDialog(); 
	}
	
	private void showProgressDialog() {
		pDlg = new ProgressDialog(mContext);
		pDlg.setMessage("Kiểm tra tài khoản...");
		pDlg.setProgressDrawable(mContext.getWallpaper());
		pDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
		pDlg.setCancelable(false);
		pDlg.show();
	}

	@Override
	protected Void doInBackground(Void... params) {
		if (isNetWork) {
			 UtilsJson.getInforBilling(Imei,extendId,videoId,amount);
			//ListVideo list = (ListVideo)mContext;
			//if(list != null)
			//{
				//list.analyseVideDetail(billingJson);
			//}
		} else {
		}
		return null;
	}

	@Override
	protected void onPostExecute(Void result) {
		super.onPostExecute(result);	
		if(pDlg != null)
			pDlg.dismiss();
	}
}

